import request from '@/utils/request'

export default {
    //省市区级联查询
    searchLocation(pid){
        return request({
            url:`/district/select?pid=${pid}`,
            method:'get'
        })
    },
    //导入房源
    addHouse(addMap){
        return request({
            url:'/house/add',
            method:'post',
            data:addMap
        })
    },
    //查询房源
    searchHouse(page,itemsPerPage,searchMap){
        return request({
            url:`/house/select?addname=jiangchen&page=${page}&itemsPerPage=${itemsPerPage}
            ${searchMap.provinceId?'&provinceId='+searchMap.provinceId:''}
            ${searchMap.cityId?'&cityId='+searchMap.cityId:''}
            ${searchMap.rentMode?'&rentMode='+searchMap.rentMode:''}
            ${searchMap.houseTypeList.length!=0?'&houseTypeList='+searchMap.houseTypeList:''}
            ${searchMap.orientationList.length!=0?'&orientationList='+searchMap.orientationList:''}
            ${searchMap.rentalList.length!=0?'&rentalList='+searchMap.rentalList:''}`,
            method:'get'
        })
        
    },
    //删除房源
    deleteHouse(id){
        return request({
            url:`/house/delete?id=${id}`,
            method:'delete',
        })
    },
    //根据id查询房源
    findHouseById(id){
        return request({
            url:`house/selectById?id=${id}`,
            method:'get',
        })
    },
    //修改房源
    updateHouse(updateForm){
        return request({
            url:'/house/update',
            method:'put',
            data:updateForm,
        })
    }
}
